﻿using Ardalis.Specification;
using System.Linq;
using System.Linq.Expressions;

namespace HuaweiCloud.Dotnet.Samples.Common
{
    public interface IDocRepository<T> where T : class
    {
        Task AddAsync(T entity, CancellationToken cancellationToken = default);
        Task UpdateAsync(T entity, CancellationToken cancellationToken = default);
        Task DeleteAsync(T entity, CancellationToken cancellationToken = default);
        Task<T?> GetByIdAsync<TId>(TId id, CancellationToken cancellationToken = default) where TId : notnull;
        Task<List<T>> ListAsync(Expression<Func<T, bool>>? filter = null, CancellationToken cancellationToken = default);
    }
}
